import request from '@/util/request'

/**
 * businessTripAdd 添加出差
 * @param id
 */
export const businessTripAdd = (data: any) => {
  return request({
    url: '/businessTrip',
    method: 'POST',
    data: data
  })
}


/**
 * businessTripRemove 通过ID删除出差
 * @param id
 */
export const businessTripRemove = (id: number) => {
  return request({
    url: '/businessTrip',
    method: 'DELETE',
    params: {
      id: id
    }
  })
}

/**
 * businessTripModify 修改出差
 * @param data BusinessTrip修改内容
 */
export const businessTripModify = (data: any) => {
  return request({
    url: '/businessTrip',
    method: 'PUT',
    data: data
  })
}


/**
 * businessTripFind 查询出差列表
 * @param data 查询参数
 * @param pageSize 分页大小
 * @param pageNum 当前页
 */
export const businessTripFind = (data: any, pageSize: number, pageNum: number) => {
  return request({
    url: '/businessTrip/list',
    method: 'GET',
    params: {
      pageNum: pageNum,
      pageSize: pageSize,
      ...data
    }
  })
}


/**
 * businessTripFindById 查找出差byId
 * @param id
 */
export const businessTripFindById = (id: number) => {
  return request({
    url: '/businessTrip',
    method: 'GET',
    params: {
      id: id
    }
  })
}


export const businessTripExpenseAdd = (data: any) => {
  return request({
    url: '/businessTrip/expense',
    method: 'POST',
    data: data
  })
}
export const businessTripExpenseFind = (params: any, pageSize: number, pageNum: number) => {
  return request({
    url: '/businessTrip/expense',
    method: 'GET',
    params: {
      ...params,
      pageSize: pageSize,
      pageNum: pageNum
    }
  })
}

export const businessTripExpenseRemove = (id: number,businessTripID:number) => {
  return request({
    url: '/businessTrip/expense',
    method: 'DELETE',
    params: {
      id: id,
      businessTripID: businessTripID
    }
  })
}
